package com.itheima.api.stream.demo02;

import java.util.*;
import java.util.stream.Stream;

public class StreamGenerate {

    public static void main(String[] args) {

        Collection<String> collection = new ArrayList<String>();
        collection.add("聂明玦");
        collection.add("聂怀桑");
        collection.add("江厌离");
        collection.stream().filter(s -> s.startsWith("聂")).forEach(s -> System.out.println(s));


        Map<String, String> hashMap = new HashMap<String, String>();
        hashMap.put("蓝湛", "含光君");
        hashMap.put("蓝涣", "泽芜君");
        hashMap.put("魏婴", "夷陵老祖");
        Set<String> keySet = hashMap.keySet();
        keySet.stream().filter( s -> s.startsWith("蓝")).forEach(s -> System.out.println(s + "," + hashMap.get(s)));

        Stream.of("蓝湛","蓝忘机","蓝涣","蓝曦臣","魏婴","魏无羡").filter(s -> s.startsWith("蓝")).forEach(s -> System.out.println(s));
    }
}
